<?php 

require_once('header.php');
require_once('html/index.php');
require_once('Class/connexionDB.Class.php');
require_once('Class/login.Class.php');
require_once('Class/session.Class.php');

$session 			= session::getInstance();

if (isset($_POST['email']) && $_POST['email'] != "" && isset($_POST['password']) && $_POST['password'] != "")
{
	$login 				= new login();

	$session->email 	= $_POST['email'];
	/*$session->password 	= $_POST['password'];*/
	
	$session->connected = $login->signIn($_POST['email'], $_POST['password']);

	if ($session->connected == true)
	{
		header("Location: index.php");
		exit();
	}
	else
	{
		header("Location: index.php?error_id=true");
		exit();	
	}
}
else
{
	if (isset($session->connected) && $session->connected == true)
	{
		header("Location: reporting.php");
		exit();
	}
}

require_once('footer.php');
?>